﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Enter.DataProxy.Mail;
using System.Data;
using Enter.Entity;
using Enter.BizLogic;
using Enter.Config;
using Enter.Common;

namespace Enter.Services.Mail
{
	public partial class Mail : IMail
    {
        #region
        public int GetBaseById(int id) 
        {
            DemoManager mail = new DemoManager();
            return mail.ShowDemo();
        }

        public DataTable GetBaseTableById(int id)
        {
            var mail = new DemoManager();
            return mail.ShowTable(id);
        }
        #endregion

        #region 图片配置
        /// <summary>
        /// 网站图片配置参数
        /// </summary>
        /// <returns></returns>
        public List<T9003_ImgDictionaryEntity> GetImgDictionaryList()
        {
            T9003_ImgDictionaryBLLSub bll = new T9003_ImgDictionaryBLLSub();
          return  bll.GetList();
        }
        /// <summary>
        /// 网站图片配置参数
        /// </summary>
        /// <returns></returns>
        public List<T9002_AreaEntity> GetAreaList()
        {
            T9002_AreaBLLSub bll = new T9002_AreaBLLSub();
            return bll.ShowList();
        }
        public void GetUploadPath(ImgRootType imgtype, out string UploadPath, out string ServerPath, out int width, out int height, out int size)
        {
            width = 0;
            height = 0;
            size = 0;
            string key = "ImgDictionary";
            List<T9003_ImgDictionaryEntity> list = (List<T9003_ImgDictionaryEntity>)CacheHelper.Get(key);
            if (list == null)
            {
                list = GetImgDictionaryList();
                CacheHelper.Set(key, list);
            }
            T9003_ImgDictionaryEntity entity = list.Find(Img => Img.FatherID == imgtype);
            if (entity != null)
            {
                width = entity.ImgWith;
                height = entity.ImgHigt;
                size = entity.FileLength;
            }
            switch (imgtype)
            {
                case ImgRootType.ShopLogo:
                    UploadPath = ImgPathConfig.ShopLogoUploadPath;
                    ServerPath = ImgPathConfig.ShopLogoServerPath;
                    break;
                case ImgRootType.product:
                    UploadPath = ImgPathConfig.productUploadPath;
                    ServerPath = ImgPathConfig.productServerPath;
                    break;
                case ImgRootType.product_list:
                    UploadPath = ImgPathConfig.productListUploadPath;
                    ServerPath = ImgPathConfig.productListServerPath;
                    break;
                case ImgRootType.product_info_big:
                    UploadPath = ImgPathConfig.productInfoUploadPath;
                    ServerPath = ImgPathConfig.productInfoServerPath;
                    break;
                case ImgRootType.product_info_small:
                    UploadPath = ImgPathConfig.productInfoUploadPath;
                    ServerPath = ImgPathConfig.productInfoServerPath;
                    break;
                case ImgRootType.product_hotbank:
                    UploadPath = ImgPathConfig.productHotUploadPath;
                    ServerPath = ImgPathConfig.productHotServerPath;
                    break;
                default:
                    UploadPath = "";
                    ServerPath = "";
                    break;
            }

        }
        #endregion

        #region 地区
        public List<T9002_AreaEntity> GetArea(string parentNo)
        {
            T9002_AreaBLLSub bll = new T9002_AreaBLLSub();
            return bll.GetArea(parentNo);
        }
        public List<T9002_AreaEntity> GetArea()
        {
            T9002_AreaBLLSub bll = new T9002_AreaBLLSub();
            return bll.GetArea();
        }
        #endregion

        /// <summary>
        /// 获取首页广告列表
        /// </summary>
        /// <returns></returns>
       public IList<T802_IndexFlashEntity> GetIndexFlashList()
        {
            T802_IndexFlashBLLSub bll = new T802_IndexFlashBLLSub();
           return bll.GetCurrentList();
        }
    }
}
